package com.wfx.controller;

import com.wfx.entity.Result;
import com.wfx.entity.UserDto;
import com.wfx.service.ISendCodeService;
import com.wfx.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
public class LoginController {

    @Autowired
    private IUserService iUserService;
    @Autowired
    private ISendCodeService iSendCodeService;

    @PostMapping("/login")
    public Result login(@RequestBody UserDto userDto){
        return iUserService.login(userDto);
    }
    //发送验证码
    @RequestMapping("/sendCode")
    public Result sendCode(String phone){
        return iSendCodeService.sendCode(phone);
    }
    //验证码登录
    @PostMapping("/loginCode")
    public Result loginCode(@RequestBody UserDto userDto){
        return iUserService.loginCode(userDto);
    }
}



